package igz.fleaxy.util {
	/**
	 * ...
	 * @author Intelygenz | www.intelygenz.com
	 */
	public class ColorUtil{
		
		public function ColorUtil() {
			
		}

		static public function $Mix(p_colorA:uint, p_colorB:uint, p_mixPercent:Number = 0.5) : uint {
			var channels:Object = { "r1" : (p_colorA & 0xFF0000) >> 16, "g1" : (p_colorA & 0x00FF00) >> 8, "b1" : p_colorA & 0x0000FF, "mix1" : p_mixPercent
								  , "r2" : (p_colorB & 0xFF0000) >> 16, "g2" : (p_colorB & 0x00FF00) >> 8, "b2" : p_colorB & 0x0000FF, "mix2" : 1-p_mixPercent
								  }
			var colorMix:uint =
			(Math.min(255, (channels["r1"] * channels["mix1"]) + (channels["r2"] * channels["mix2"])) << 16)
			+
			(Math.min(255, (channels["g1"] * channels["mix1"]) + (channels["g2"] * channels["mix2"])) << 8)
			+
			(Math.min(255, (channels["b1"] * channels["mix1"]) + (channels["b2"] * channels["mix2"])))
			;
			return colorMix;
		}
	}

}